Skip to content

Fix MDI child windows not appearing and menu corruption for Win16 apps#33

Merged
lqs merged 1 commit intolqs:mainfrom
ohuet:MDI-fix
Apr 3, 2026
Merged

Fix MDI child windows not appearing and menu corruption for Win16 apps#33
lqs merged 1 commit intolqs:mainfrom
ohuet:MDI-fix

Conversation

@ohuet
Copy link
Copy Markdown
Contributor

@ohuet ohuet commented Apr 2, 2026

Summary

  • MDI child windows invisible: The WM_MDICREATE handler read 16-bit coordinates as unsigned, so negative values like
    y=-1026 (0xFBFE) were stored as 64510, placing the window off-screen. Now sign-extends coordinates and clamps to
    MDICLIENT area.
  • Menu opens corrupt Win16 CPU state: handleMenuOpen called callWndProc() (Win32) for all apps, including Win16 NE
    executables like WINFILE.EXE. This corrupted the stack and EIP, making Window > New Window and File > Exit
    unresponsive. Now uses callWndProc16() for NE apps.

Test plan

  • Open WINFILE.EXE — MDI child window should appear filling the MDICLIENT area
  • Click Window > New Window — a second MDI child should open
  • Click File > Exit or the close button — WINFILE should close normally
  • Open a Win32 app with menus (e.g. Notepad) — menus should still work

- message.ts:
  Sign-extend 16-bit MDICREATESTRUCT coordinates (same as MoveWindow/SetWindowPos)
  Clamp negative positions to 0 and oversized children to fill MDICLIENT area
  WINFILE passed y=-1026 (0xFBFE) which was stored as 64510 unsigned → off-screen
- EmulatorView.tsx:
  Use callWndProc16 for NE apps in handleMenuOpen (was using Win32 callWndProc)
  Opening a menu on a Win16 app corrupted CPU state, breaking New Window and Exit
- window.ts:
  Minor whitespace cleanup in SetWindowPos

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lqs lqs merged commit 6c74225 into lqs:main Apr 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants